<template>
<div>
  <h1>主页</h1>
<!--  校区展示-->
  <div>
    <h2>所有校区</h2>
    <table>
      <tr>
        <td>校区</td>
        <td>校区简介</td>
      </tr>
      <tr v-for="i in xiaoqu_list">
        <td>{{i.name}}</td>
        <td>{{i.text}}</td>
      </tr>
    </table>
  </div>
<!--  班级展示-->
  <div>
    <h2>所有班级</h2>
    <table border="1" cellpadding="0">
      <tr>
        <td>班级</td>
        <td>开班时间</td>
        <td>结课时间</td>
        <td>所属校区</td>
      </tr>
      <tr v-for="i in class_list">
        <td>{{i.name}}</td>
        <td> {{i.date}} </td>
        <td>{{i.close}}</td>
        <td>{{i.sxiaoqu}}</td>
      </tr>
    </table>
  </div>
<!--  学员展示-->
  <div>
    <table>
      <tr>
        <td>姓名</td>
        <td>手机号</td>
        <td>所属班级</td>
        <td>所属校区</td>
        <td>所属老师</td>
      </tr>
      <tr v-for="i in xueyuan_list">
        <td>{{i.name}}</td>
        <td>{{i.mobile}}</td>
        <td>{{i.sclass}}</td>
        <td>{{i.sxiaoqu}}</td>
        <td>{{i.xuser}}</td>
      </tr>
    </table>
  </div>
</div>
</template>

<script>
export default {
  name: "xzhuye",
  data(){
    return{
      xiaoqu_list:[],
      class_list :[],
      xueyuan_list:[]
    }
  },
  methods:{
    show_xiaoqu(){
      this.$axios.get('users/Xuser_API/')
      .then(i=>{
        this.xiaoqu_list = i.data.list
      })
    },
    show_class(){
      this.$axios.get('users/Xclass_API/')
        .then(i=>{
          this.class_list = i.data.list
        })
    },
    show_xueyuan(){
      this.$axios.get('users/XXstu_API/?userid='+localStorage.getItem('userid'))
        .then(i=>{
          this.xueyuan_list = i.data.list
        })
    }
  },
  mounted() {
    this.show_xiaoqu()
    this.show_class()
    this.show_xueyuan()
  }
}
</script>

<style scoped>

</style>
